package com.example.administrator.biyesheji_print.Adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by Administrator on 2018/3/29.
 */

public class MyFragmentAdapter extends FragmentPagerAdapter {
    List<Fragment> mlist;
    public MyFragmentAdapter(FragmentManager fm, List<Fragment> mlist) {
        super(fm);
        this.mlist=mlist;
    }

    @Override
    public Fragment getItem(int position) {
        return mlist.get(position);
    }
//    /**
//     * 覆盖destroyItem方法可阻止销毁Fragment
//     */
//    @Override
//    public void destroyItem(ViewGroup container, int position, Object object) {
//        //super.destroyItem(container, position, object);
//    }

//    @Override
//    public long getItemId(int position) {
//        int i = mlist.get(position).hashCode();
//        return i;
//    }

    @Override
    public int getCount() {
        return mlist.size();
    }


}
